#include <GameEngine/Gameplay/Objects/object.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

#ifndef DOXYGEN_IGNORE
#include "object.moc"
#endif

//=================================================================================


GAMEENGINE_IMPLEMENT_RTTI(Object)

//! Default constructor
Object::Object() : state_(Normal), ObjectWorld() {}

//! Copy constructor
/*!
 @param rhs The object to copy
 */
Object::Object(const Object& rhs) : stats_(rhs.stats_), state_(rhs.state_), ObjectWorld(rhs) {}

//! Assignment operator
/*!
 @param rhs The object to copy
 */
Object& Object::operator=(const Object& rhs) {
	if ( &rhs != this ) {
		ObjectWorld::operator=(rhs);
		stats_ = rhs.stats_;
		state_ = rhs.state_;
	}
	return *this;
}

//! Destructor
Object::~Object() {}

//! Accessor to the statistics manager of the object (read only)
/*!
 @return A constant reference to the statistics manager of the object
 */
const StatisticsManager& Object::stats() const {
	return stats_;
}

//! Accessor to the statistics manager of the object (read-write)
/*!
 @return A reference to the statistics manager of the object
 */
StatisticsManager& Object::stats() {
	return stats_;
}

//! Accessor to the current state of the object (read only)
/*!
 @return The current state of the object
 */
Object::State Object::state() const {
	return state_;
}

//! Change the state of the object
/*!
 @param state The new state of the object
 @note If the new state is different from the previous one, the
       state_changed signal is emitted
 */
void Object::set_state(State state) {
	if ( state_ == state ) return;
	state_ = state;
	emit state_changed(state);
}

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif
